package serviceImpl;

import dao.DepartmentMapper;
import entity.Department;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import service.DepartmentService;

import java.util.List;

@Service
public class DepartmentServiceImpl implements DepartmentService {
    @Autowired
    private DepartmentMapper departmentMapper;

    public Department getDepartmentByDepID(String DepID) {
        return departmentMapper.getDepartmentByDepID(DepID);
    }

    @Override
    public List<Department> getAllDepartments() {
        return departmentMapper.getAllDepartments();
    }

    @Override
    public boolean updateDepartment(Department department) {
        return departmentMapper.updateDepartment(department);
    }

    @Override
    public boolean deleteDepartment(String depID) {
        return departmentMapper.deleteDepartment(depID);
    }

    @Override
    public boolean addDepartment(Department department) {
        return departmentMapper.addDepartment(department);
    }

    @Override
    public List<Department> getDepartmentByDepNameORDepID(String depID, String depName) {
        return departmentMapper.getDepartmentByDepNameORDepID(depID,depName);
    }
}

